using System;
using System.IO;
using Data;
using UnityEngine;

public class EditLevelConditions : MonoBehaviour
{
	public void ChangeMode()
	{
		if (this.OnChangeMode != null)
		{
			this.OnChangeMode();
		}
	}

	public void LoadLevel(int index)
	{
		if (this.OnLevelLoad != null)
		{
			this.OnLevelLoad(index);
		}
	}

	public void ChangeLevel(int index, int index2)
	{
		if (this.OnChangeLevel != null)
		{
			this.OnChangeLevel(index, index2);
		}
	}

	public void DeleteLevel(int index)
	{
		if (this.OnDeleteLevel != null)
		{
			this.OnDeleteLevel(index);
		}
	}

	public void ShuppleIndex(int index)
	{
		if (this.OnShuppleIndex != null)
		{
			this.OnShuppleIndex(index);
		}
	}

	public void AuthorAllLevel()
	{
		string text = PlayerPrefs.GetString("DataSet");
		if (text == string.Empty)
		{
			text = "MASTER";
		}
		int num = DataContainer<Data.Root>.Data.packages.Length;
		for (int i = 0; i < DataContainer<Data.Root>.Data.packages.Length; i++)
		{
			string text2 = DataContainer<Data.Root>.Data.packages[i].name;
			text2 = text2.Replace("_", string.Empty);
			string text3 = string.Concat(new string[]
			{
				"Assets/Data/text/",
				text,
				"/000_NORMAL/",
				i.ToString("D3"),
				"_",
				text2
			});
			Level[] levels = DataContainer<Data.Root>.Data.packages[i].levels;
			if (!Directory.Exists(text3))
			{
				Directory.CreateDirectory(text3);
			}
			for (int j = 0; j < levels.Length; j++)
			{
				string path = text3 + "/" + (j + 1).ToString() + ".txt";
				File.Create(path).Dispose();
				if (string.IsNullOrEmpty(levels[j].author))
				{
					levels[j].author = "unknown";
				}
				string contents = JsonUtility.ToJson(levels[j]);
				File.WriteAllText(path, contents);
			}
		}
	}

	public void GeneratorLevel(int index)
	{
		if (this.OnGeneratorLevel != null)
		{
			this.OnGeneratorLevel(index);
		}
	}

	public void AddGeneratorLevel(int index)
	{
		if (this.OnAddGeneratorLevel != null)
		{
			this.OnAddGeneratorLevel(index);
		}
	}

	public void UpdateLevel(int index)
	{
		if (this.OnUpdateLevel != null)
		{
			this.OnUpdateLevel(index);
		}
	}

	public void RandomGeneratorLevel(int index)
	{
		if (this.OnRandomGeneratorLevel != null)
		{
			this.OnRandomGeneratorLevel(index);
		}
	}

	public void RandomAddGeneratorLevel(int index)
	{
		if (this.OnRandomAddGeneratorLevel != null)
		{
			this.OnRandomAddGeneratorLevel(index);
		}
	}

	public void RandomUpdateLevel(int index)
	{
		if (this.OnRandomUpdateLevel != null)
		{
			this.OnRandomUpdateLevel(index);
		}
	}

	public void LoadLevelDraw(int index)
	{
		if (this.OnLoadLevelDraw != null)
		{
			this.OnLoadLevelDraw(index);
		}
	}

	public void LoadRandomDraw()
	{
		if (this.OnLoadRandomDraw != null)
		{
			this.OnLoadRandomDraw();
		}
	}

	public void OverlapCheck()
	{
		if (this.OnOverlapCheck != null)
		{
			this.OnOverlapCheck();
		}
	}

	public void SortNumber()
	{
		if (this.OnSortNumber != null)
		{
			this.OnSortNumber();
		}
	}

	public void TwoOverlapPackage()
	{
		if (this.OnTwoOverlapPackage != null)
		{
			this.OnTwoOverlapPackage();
		}
	}

	public void PackageOverlapBlockCheck()
	{
		if (this.OnPackageOverlapBlockCheck != null)
		{
			this.OnPackageOverlapBlockCheck();
		}
	}

	public void Porting()
	{
		if (this.OnPorting != null)
		{
			this.OnPorting();
		}
	}

	public void SetPicture(int index)
	{
		if (this.OnSetPicture != null)
		{
			this.OnSetPicture(index);
		}
	}

	public void DelPicture(int index)
	{
		if (this.OnDelPicture != null)
		{
			this.OnDelPicture(index);
		}
	}

	[HideInInspector]
	public string author;

	[HideInInspector]
	public int levelIndex;

	[HideInInspector]
	public int levelLength;

	[HideInInspector]
	public GameType gameType;

	public bool isCustom;

	public bool isFake;

	public int fakeCount = 1;

	[HideInInspector]
	public bool isDouble;

	[HideInInspector]
	public bool isRotate;

	[HideInInspector]
	public int prevModeName;

	[HideInInspector]
	public int modeName;

	[HideInInspector]
	public string prevPackageName;

	[HideInInspector]
	[SerializeField]
	public string packageName;

	[HideInInspector]
	[SerializeField]
	public int levelCount = 1;

	[HideInInspector]
	[SerializeField]
	public string pictureTheme;

	[HideInInspector]
	[SerializeField]
	public string pictureName;

	[HideInInspector]
	[SerializeField]
	public int widthMin = 5;

	[HideInInspector]
	[SerializeField]
	public int widthMax = 5;

	[HideInInspector]
	[SerializeField]
	public int heightMin = 5;

	[HideInInspector]
	[SerializeField]
	public int heightMax = 5;

	[HideInInspector]
	[SerializeField]
	public int minBlockTile = 4;

	[HideInInspector]
	[SerializeField]
	public int maxBlockTile = 6;

	[HideInInspector]
	[SerializeField]
	public int blockCount = 6;

	[HideInInspector]
	[SerializeField]
	public int overlapBlockCount = 999;

	[HideInInspector]
	public string packageTextName;

	[HideInInspector]
	public string portingPackage;

	[HideInInspector]
	public string porting;

	public Action OnChangeMode;

	public Action<int> OnLevelLoad;

	public Action<int> OnDeleteLevel;

	public Action<int, int> OnChangeLevel;

	public Action<int> OnGeneratorLevel;

	public Action<int> OnAddGeneratorLevel;

	public Action<int> OnUpdateLevel;

	public Action<int> OnRandomGeneratorLevel;

	public Action<int> OnRandomAddGeneratorLevel;

	public Action<int> OnRandomUpdateLevel;

	public Action<int> OnLoadLevelDraw;

	public Action OnLoadRandomDraw;

	public Action<int> OnShuppleIndex;

	public Action OnOverlapCheck;

	public Action OnBackUp;

	public Action OnSortNumber;

	public Action OnTwoOverlapPackage;

	public Action OnPackageOverlapBlockCheck;

	public Action OnPorting;

	public Action<int> OnSetPicture;

	public Action<int> OnDelPicture;
}
